<?php

namespace app\api\controller\ai;

use app\common\controller\BaseController;
use hg\apidoc\annotation as Apidoc;
use app\common\service\ai\ErnieService;

/**
 * @Apidoc\Title("智能文案管理")
 * @Apidoc\Group("ai")
 * @Apidoc\Sort("300")
 */
class Ernie extends BaseController {

    /**
     * @Apidoc\Title("对话")
     * @Apidoc\Method("POST")
     * @Apidoc\Param("content", type="string", require=true, desc="对话内容")
     * @Apidoc\Returned("result", type="string", require=true, desc="对话返回结果")
     */
    public function chat() {
        $list = ErnieService::chat($this->data);
        return $list ? success($list) : error('生成文案失败');
    }

}
